<template>
    <div>
        <el-button  style="margin-top: 30px; margin-bottom: 30px" type="primary" icon="el-icon-plus" @click="open_t">新增招聘</el-button>
        <el-dialog
                title="新增招聘"
                :visible.sync="dialogVisible_2"
                width="50%"
                >
            <div>
                <div>
                    <span>职位名称：</span>
                    <el-input size="mini" style="width: 150px" prefix-icon="el-icon-edit" v-model="recruit.position"
                              placeholder="请输入职位名称"></el-input>
                </div>
                <div style="margin-top: 20px">
                    <span>职位职责：</span>
                    <el-input size="mini" style="width: 450px" prefix-icon="el-icon-edit" v-model="recruit.duty"
                              placeholder="请输入职位职责"></el-input>
                </div>
                <div style="margin-top: 20px">
                    <span>职位要求：</span>
                    <el-input size="mini" style="width: 450px" prefix-icon="el-icon-edit" v-model="recruit.requirement"
                              placeholder="请输入职位要求"></el-input>
                </div>
                <div style="margin-top: 20px">
                    <span>招聘类型：</span>
                    <el-input size="mini" style="width: 250px" prefix-icon="el-icon-edit" v-model="recruit.work_type"
                              placeholder="请输入招聘类型"></el-input>
                </div>
                <div style="margin-top: 20px">
                    <span>工作地点：</span>
                    <el-input size="mini" style="width: 450px" prefix-icon="el-icon-edit" v-model="recruit.work_location"
                              placeholder="请输入工作地点"></el-input>
                </div>
                <div style="margin-top: 20px">
                    <span>学历要求：</span>
                    <el-input size="mini" style="width: 450px" prefix-icon="el-icon-edit" v-model="recruit.degree"
                              placeholder="请输入学历要求"></el-input>
                </div>
                <div style="margin-top: 20px">
                    <span>招聘人数：</span>
                    <el-input size="mini" style="width: 450px" prefix-icon="el-icon-edit" v-model="recruit.num"
                              placeholder="请输入招聘人数"></el-input>
                </div>
            </div>
            <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible_2 = false">取 消</el-button>
    <el-button type="primary" @click="doAddRecruit">发起审核</el-button>
  </span>
        </el-dialog>
        <el-table
            :data="tableData"
            border
            style="width: 100%">
        <el-table-column
                prop="position"
                label="职位"
                width="180">
        </el-table-column>
        <el-table-column
                prop="duty"
                label="岗位职责"
                width="180">
        </el-table-column>
        <el-table-column
                prop="requirement"
                label="任职要求"
                width="180">
        </el-table-column>
        <el-table-column
                prop="work_location"
                label="工作地点"
                width="90">
        </el-table-column>
        <el-table-column
                prop="status"
                label="状态"
                width="160">
            <template slot-scope="scope">
                <el-tag type="success" effect="dark" v-if="scope.row.status==1">已审核</el-tag>
                <el-tag type="danger" effect="dark" v-else>未审核</el-tag>
            </template>

        </el-table-column>
        <el-table-column
                prop="status"
                label="操作"
                width="240">
            <template slot-scope="scope">
                <el-button type="primary" @click="open(scope.row)">查看详情</el-button>
            </template>
        </el-table-column>

    </el-table>
    <el-dialog
            title="销售总监"
            :visible.sync="dialogVisible"
            width="50%"
            >
        <div >
            <span style="font-weight: 800;">招聘类型：社会</span>
            <span style="margin-left: 100px">工作地点：广州市-荔湾区</span>
            <span style="margin-left: 100px">学历要求：大专</span>
            <div style="margin-top: 30px">招聘人数：1</div>
            <div style="margin-top: 30px">
                <div style="width: 4px;display: inline-block;vertical-align:bottom;height: 20px;
background: #2E87FF;
opacity: 1;
"></div>
                <div style="display: inline">

                    岗位职责：
                    <div style="margin-top: 8px">{{recruit.duty}}</div>
                </div>
                <div style="margin-top: 30px">
                <div style="width: 4px;display: inline-block;   vertical-align:bottom;height: 20px;
background: #2E87FF;
opacity: 1;
"></div>
                <div style="margin-top: 30px;display: inline">
                    职位要求：
                    <div style="margin-top: 8px">{{recruit.requirement}}</div>
                </div>
            </div>
        </div>
        </div>
        <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  </span>
    </el-dialog>
    </div>
</template>

<script>
    export default {
        methods: {
            initData(){
                this.getRequest('/recruit/getAllRecruit').then(resp=>{

                    console.log(resp)
                    this.tableData=resp
                })
            },
            doAddRecruit(){

                this.postRequest('/recruit/addRecruit',this.recruit).then(resp=>{
                })
                this.dialogVisible_2=false
            },
            open_t(){
                this.recruit={}
                this.dialogVisible_2=true
            },
            open(data){
                this.dialogVisible=true;
                this.recruit=data
            }
        },
        mounted(){
          this.initData()
        },
        data() {
            return {
                recruit:{
                    position:"名称",
                    work_location:"地点",
                    work_type:"类型",
                    degree:"学位",
                    num:'5',
                    requirement:'要求',
                    duty:'职责'
                },
                recruits:[],
                dialogVisible: false,
                dialogVisible_2:false,
                tableData: []
            }
        }
    }
</script>
